package com.chenhy.springbootvuesmbms.service;

import com.chenhy.springbootvuesmbms.mapper.ProviderMapper;
import com.chenhy.springbootvuesmbms.pojo.Provider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProviderServiceImpl implements ProviderService {

    @Autowired
    ProviderMapper providerMapper;

    @Override
    public List<Provider> queryAllProvider() {
        return providerMapper.queryAllProvider();
    }

    @Override

    public List<Provider> userFuzzyQuery(String condition) {
        return providerMapper.userFuzzyQuery(condition);
    }

    @Override
    public int addProvider(Provider provider) {
//        LoginUser loginUser = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        provider.setCreatedBy(loginUser.getId());
//        provider.setModifyBy(loginUser.getId());
//        return providerMapper.addProvider(provider);
        return 0;
    }

    @Override
    public int deleteProvider(int id) {
        return providerMapper.deleteProvider(id);
    }

    @Override
    public Provider queryProviderById(int id) {
        return providerMapper.queryProviderById(id);
    }

    @Override
    public int updateProvider(Provider provider) {
//        LoginUser loginUser = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        provider.setModifyBy(loginUser.getId());
//        return providerMapper.updateProvider(provider);
        return 0;
    }


}
